import fhupRequest from '../index'
import type { IAccLogin } from './type'
import type { ILoginResult } from './type'
import { IDatatype } from '../types'
enum LoginAPI {
  AccountLogin = '/login',
  LoginUserInfo = '/users/', //   /users/1
  UserMenus = '/role/' //   /role/1/menu
}

export function accountLoginRequest(account: IAccLogin) {
  return fhupRequest.post<IDatatype<ILoginResult>>({
    url: LoginAPI.AccountLogin,
    data: account
  })
}

export function requestUserInfoById(id: number) {
  return fhupRequest.get<IDatatype>({
    url: LoginAPI.LoginUserInfo + id,
    showLoading: false
  })
}

export function requestUserMenusById(id: number) {
  return fhupRequest.get<IDatatype>({
    url: LoginAPI.UserMenus + id + '/menu',
    showLoading: false
  })
}
